package com.hecn.mapper;

import com.hecn.pojo.User;
import lombok.Setter;
import org.apache.ibatis.session.SqlSession;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

@Setter
public class UserMapperImpl implements UserMapper {
  /**
   * 在原来，我们所有的操作都使用sqlsession来执行;
   *
   * <p>现在，都使用sqlsessionTemplate;
   */
  private SqlSession sqlSession;

  /** @return 查询用户 */
  public List<User> selectUser() {
//    UserMapper mapper = sqlSession.getMapper(UserMapper.class);
//    return mapper.selectUser();
    return sqlSession.getMapper(UserMapper.class).selectUser();
  }
}
